package com.gaussian.property.app.controller;

import com.gaussian.property.app.service.SuggestService;
import com.gaussian.property.app.vo.suggest.HistorySuggest;
import com.gaussian.property.app.vo.suggest.SuggestForm;
import com.songqi.common.core.domain.R;
import com.songqi.common.web.request.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description:
 * @author: songqi(13776346982)
 * @date: 2024/4/18 20:25
 */
@Api(tags = "项目建议相关操作")
@Validated
@RestController
@RequestMapping("suggest/")
public class SuggestController extends BaseController {

    @Autowired
    private SuggestService suggestService;


    @ApiOperation("提交建议")
    @PostMapping("submitSuggest")
    public R<Void> submitSuggest(@Validated @RequestBody SuggestForm suggestForm){
        suggestService.submitSuggest(suggestForm);
        return success();
    }


    @ApiOperation("查看我的历史建议")
    @GetMapping("listHistorySuggest")
    public R<List<HistorySuggest>> listHistorySuggest(String projectId){
        return R.success(suggestService.listHistorySuggest(projectId));

    }
}
